<?php
include 'config.php';
if (isset($_POST['loginSubmit'])) {
	$userid = $_POST["userid"];
	$userpin = $_POST["userpin"];
	$con = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
	$query = "SELECT * FROM users WHERE userid = '$userid' AND userpin = '$userpin'";
	$result = mysqli_query($con, $query);
	if (mysqli_num_rows($result) > 0) {
		$_SESSION['userid'] = $userid;
		header('LOCATION: index-page.php');
		exit();
	} 
	else {
		//header('LOCATION: index.php');
	}
}
?>